//
//  TagCollectionViewCell.m
//  XMenSwift
//
//  Created by Jason on 2022/3/24.
//

#import "TagCollectionViewCell.h"
#import <Masonry/Masonry.h>
#import "Utils.h"

@interface TagCollectionViewCell ()

/** <#名字#> */
@property (nonatomic ,strong) UIView *bgView;


@end

@implementation TagCollectionViewCell


- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self configUI];
    }
    return self;
}

- (void)configUI {
    
    UIView *bgView = [[UIView alloc] init];
    bgView.backgroundColor = [UIColor redColor];
    _bgView = bgView;
    ViewRadius(bgView, 4.0);
    [self.contentView addSubview:bgView];
   
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = [UIFont systemFontOfSize:15.0];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
//    //设置字体缩放
//    titleLabel.adjustsFontSizeToFitWidth = YES;
//    //最小五号
//    titleLabel.minimumScaleFactor = 0.5;
    [bgView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(bgView);
        make.left.equalTo(bgView).offset(5);
        make.right.equalTo(bgView).offset(-5);
        make.bottom.equalTo(bgView);
    }];

}

@end
